package cn.ahaiahaixx.dp.prototype;

/**
 * 系统已经完成了浅表克隆的原型模式
 * 
 * @author Aiden Pearce
 * 第一步;实现Cloneable接口（标志性接口，不用实现任何方法）
 *
 */
public class SysPrototype implements Cloneable{
  private int pid;
  private String info;
  
  /**
   * 覆写父类clone方法，提示可见度即可，不用改写代码
   */
  @Override
  protected Object clone() {
    try {
      return super.clone();
    } catch (CloneNotSupportedException e) {
      return null;
    }
  }

  public SysPrototype() {

  }
  
  public int getPid() {
    return pid;
  }

  public void setPid(int pid) {
    this.pid = pid;
  }

  public String getInfo() {
    return info;
  }

  public void setInfo(String info) {
    this.info = info;
  }

  @Override
  public String toString() {
    return "SysPrototype [pid=" + pid + ", info=" + info + "]";
  }

  public SysPrototype(int pid, String info) {
    super();
    this.pid = pid;
    this.info = info;
  }

}
